<?php defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH.'/libraries/REST_Controller.php';

class Article extends REST_Controller
{
	function index_get()
	{
	    $this->load->model('article_model');
	    $res = $this->article_model->get_all_article();
	    $this->response($res, 200);
	}
	function id_get($id){
	    $this->load->model('article_model');
	    $id = array('id'=>$id);
	    $res = $this->article_model->get_id_article($id);
	    $this->response($id, 200);
	}
	function add_post(){
	    $array = $this->get_post_array($_POST);
	    $data['table'] = 'article';
	    $data['array'] = $array; 
	    $this->load->model('article_model');
	    $res = $this->article_model->add_article($data);
	    $this->response($res, 200);
	}
	
}